package pattern.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import pattern.WorkServiceTool;
import pattern.annontations.Menu;
import pattern.annontations.Secure;
import pattern.dto.SysLog;
import pattern.dto.model.system.SysLogModel;
import pattern.limitconfig.RateLimiter;
import pattern.result.ResponsePage;
import pattern.routing.WorkMainApiRouting;

/**
 * @author Simon
 * @date 2021-06-17
 */
@Api(tags = "系统日志")
@RestController
@RequestMapping(value = WorkMainApiRouting.SysLog.BASE)
@Menu(menuName = "sysLog", menuUri = "sysLog", foundational = false)
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@Secure
@Slf4j
public class SysLogController {

    @RateLimiter(value = 5000)
    @ApiOperation(value = "查询")
    @GetMapping(WorkMainApiRouting.User.SEARCH)
    @Secure(actionUri = "syslog:search", actionName = "search", actionNote = "sysLog")
    public ResponsePage<SysLog> search(SysLogModel model) {
        return WorkServiceTool.getSysLogService().page(model);
    }

}
